<?php
/**
 * Copyright 2010 Dave Keen
 * http://www.actionscriptdeveloper.co.uk
 *
 * This file is part of Flextrine.
 *
 * Flextrine is free software: you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * Lesser GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * and the Lesser GNU General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */

use Doctrine\Common\Cache\ApcCache,
    Doctrine\ORM\Configuration,
    Doctrine\ORM\EntityManager,
	Doctrine\ORM\Mapping\Driver\AnnotationDriver,
	Doctrine\Common\Annotations\AnnotationReader,
	Flextrine\Config;

// Inject setup values from config.php into Flextrine\Config
include("config.php");

if (isset($flextrineIncludePath))
	set_include_path(get_include_path().PATH_SEPARATOR.$flextrineIncludePath);
	
// We need to bootstrap Doctrine class loaders for Doctrine, vo and the proxies.  Since this is done in gateway.php before the
// service call itself there is no need to include or require in any Flextrine service.
require_once "Doctrine/Common/ClassLoader.php";

$doctrineClassLoader = new \Doctrine\Common\ClassLoader("Doctrine");
$doctrineClassLoader->register();
$doctrineClassLoader = new \Doctrine\Common\ClassLoader("Flextrine");
$doctrineClassLoader->register();
$entitiesClassLoader = new \Doctrine\Common\ClassLoader(null, dirname(__FILE__)."/entities");
$entitiesClassLoader->register();
$proxiesClassLoader = new \Doctrine\Common\ClassLoader("Proxies", dirname(__FILE__)."/Proxies");
$proxiesClassLoader->register();

Config::$connectionOptions = $connectionOptions;
Config::$proxyDir = $proxyDir;
Config::$entityDir = $entityDir;
Config::$serviceDir = $serviceDir;
Config::$flextrineManagerEnabled = $flextrineManagerEnabled;

Config::init();
?>